/**
  ******************************************************************************
  * @file    Project/STM32F10x_StdPeriph_Template/platform_config.h 
  * @author  uLuxx
  * @version V0.1
  * @date    08-August-2014
  * @brief   Board specific configuration file.
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2014</center></h2>
  ******************************************************************************
  */ 

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __PLATFORM_CONFIG_H
#define __PLATFORM_CONFIG_H

/* Includes ------------------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Uncomment the line corresponding to the board used to run */
#if !defined (USE_STM3210C_EVAL)&&  !defined (USE_STM32F103HW)
  #error DEFINE BOARD TO USE!
#endif

// TODO: Set the right pins! uLuxx 20140815
#ifdef USE_STM3210C_EVAL

  #define USART1_GPIO               GPIOA
  #define USART1_CLK                RCC_APB2Periph_USART1
  #define USART1_GPIO_CLK           RCC_APB2Periph_GPIOA
  #define USART1_RxPin              GPIO_Pin_10
  #define USART1_TxPin              GPIO_Pin_9
  #define USART1_Tx_DMA_Channel     DMA1_Channel4
  #define USART1_Tx_DMA_FLAG        DMA1_FLAG_TC4
  #define USART1_DR_Base            0x40013804

  #define SPI_MASTER                SPI1
  #define SPI_MASTER_REMAP          GPIO_Remap_SPI1
  #define SPI_MASTER_CLK            RCC_APB2Periph_SPI1
  #define SPI_MASTER_GPIO           GPIOA
  #define SPI_MASTER_GPIO_CLK       RCC_APB2Periph_GPIOA  
  #define SPI_MASTER_PIN_CS         GPIO_Pin_4
  #define SPI_MASTER_PIN_SCK        GPIO_Pin_5
  #define SPI_MASTER_PIN_MISO       GPIO_Pin_6

  #define VRIN_PIN                  GPIO_Pin_1
  #define VRIN_GPIO                 GPIOA

  #define ADC_Channel_AFR           ADC_Channel_1    
  #define ADC_Channel_Battery       ADC_Channel_2
  #define ADC_AFR_GPIO              GPIOA    
  #define ADC_AFR_PIN               GPIO_Pin_1
  #define ADC_Battery_GPIO          GPIOA
  #define ADC_Battery_PIN           GPIO_Pin_2

  #define RCC_APB2Periph_GPIO_CAN1  RCC_APB2Periph_GPIOD
  #define GPIO_Remapping_CAN1       GPIO_Remap2_CAN1
  #define GPIO_CAN1                 GPIOD  
  #define GPIO_Pin_CAN1_RX          GPIO_Pin_0
  #define GPIO_Pin_CAN1_TX          GPIO_Pin_1

  #define GPIO_CAN                  GPIO_CAN1
  #define GPIO_Remapping_CAN        GPIO_Remapping_CAN1
  #define GPIO_CAN                  GPIO_CAN1
  #define GPIO_Pin_CAN_RX           GPIO_Pin_CAN1_RX
  #define GPIO_Pin_CAN_TX           GPIO_Pin_CAN1_TX

  #define GENERAL_GPIO_CLK          RCC_APB2Periph_GPIOD

  #define TIM2_CAPTURE_GPIO_CLK     RCC_APB2Periph_GPIOD

#elif defined (STM32F103HW)

  #define USART1_GPIO               GPIOA
  #define USART1_CLK                RCC_APB2Periph_USART1
  #define USART1_GPIO_CLK           RCC_APB2Periph_GPIOA
  #define USART1_RxPin              GPIO_Pin_10
  #define USART1_TxPin              GPIO_Pin_9
  #define USART1_Tx_DMA_Channel     DMA1_Channel4
  #define USART1_Tx_DMA_FLAG        DMA1_FLAG_TC4
  #define USART1_DR_Base            0x40013804

  #define SPI_MASTER                SPI1
  #define SPI_MASTER_REMAP          GPIO_Remap_SPI1
  #define SPI_MASTER_CLK            RCC_APB2Periph_SPI1
  #define SPI_MASTER_GPIO           GPIOA
  #define SPI_MASTER_GPIO_CLK       RCC_APB2Periph_GPIOA  
  #define SPI_MASTER_PIN_CS         GPIO_Pin_4
  #define SPI_MASTER_PIN_SCK        GPIO_Pin_5
  #define SPI_MASTER_PIN_MISO       GPIO_Pin_6

  #define VRIN_PIN                  GPIO_Pin_1
  #define VRIN_GPIO                 GPIOA

  #define ADC_Channel_AFR           ADC_Channel_1    
  #define ADC_Channel_Battery       ADC_Channel_2
  #define ADC_AFR_GPIO              GPIOA    
  #define ADC_AFR_PIN               GPIO_in_1
  #define ADC_Battery_GPIO          GPIOA
  #define ADC_Battery_PIN           GPIO_in_2

  #define RCC_APB2Periph_GPIO_CAN1  RCC_APB2Periph_GPIOD
  #define GPIO_Remapping_CAN1       GPIO_Remap2_CAN1
  #define GPIO_CAN1                 GPIOD  
  #define GPIO_Pin_CAN1_RX          GPIO_Pin_0
  #define GPIO_Pin_CAN1_TX          GPIO_Pin_1

  #define GPIO_CAN                  GPIO_CAN1
  #define GPIO_Remapping_CAN        GPIO_Remapping_CAN1
  #define GPIO_CAN                  GPIO_CAN1
  #define GPIO_Pin_CAN_RX           GPIO_Pin_CAN1_RX
  #define GPIO_Pin_CAN_TX           GPIO_Pin_CAN1_TX

  #define GENERAL_GPIO_CLK          RCC_APB2Periph_GPIOD

  #define TIM2_CAPTURE_GPIO_CLK     RCC_APB2Periph_GPIOD

#endif

/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

#endif /* __PLATFORM_CONFIG_H */

/******************* (C) COPYRIGHT 2014 *****END OF FILE****/
